Add nested multi-resolution volume render backend - #337
Open
ojessop01 wants to merge 2 commits into
Open
Conversation
Implement efficient Sparse Multi-Scale Grid algorithm (Benitez-Llambay 2025) for 3D volume rendering of SPH data. Particles are hierarchically assigned to grid levels based on kernel smoothing length, then scattered onto coarse-to-fine grids and upsampled back to target resolution. This bounds per-particle work regardless of smoothing length, providing significant speedups for simulations with wide kernel distributions. Features: - New nested grid backend accessible via backend="nested" parameter - Adaptive hierarchy with configurable target voxels per kernel (ntarget) and number of levels (nlevels) - Kernel arithmetic matches scatter.py implementation (Wendland-C2) - Parallel support via Numba prange - Trilinear upsampling for hierarchy collapse - Efficient bounding-box tracking to skip empty regions API additions: - render_voxel_grid() and render_gas() now accept backend, ntarget, nlevels - backends dict updated to include "nested" alongside "scatter" - Added validation and warnings for backend-specific parameters Tests: - Added TestNestedVolumeRender class with serial/parallel matching tests - Tests cover periodic boundary conditions and edge cases - Comparison against single-resolution backend validates correctness Documentation: - Updated volume_render.rst with nested backend description and examples - Added parameter documentation for ntarget and nlevels Code quality: - Passes ruff linter - Passes numpydoc validation - All existing tests continue to pass Refs: Benitez-Llambay A., 2025, MNRAS (in prep) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Member
|
Thanks Owen, looks promising. Presumably this can be trivially translated to the 2D ("project") case? And maybe slice, too? Or do you think it's not worth it because that scales as N^2 instead of N^3? |
Author
|
Yes this could be trivially extended to 2d projection and slice and would scale much better than the current implementations. I just haven't had a chance to implement this and ensure all the formatting etc is correct and the documentation written. |
kyleaoman
marked this pull request as draft
June 24, 2026 21:21
Member
|
Great, and not a problem - marking this as draft for now if you plan to add that (if not feel free to mark ready for review). |
Author
|
i plan to add eventually but not sure when I can get around to it. I will submit this ready for review for now. |
ojessop01
marked this pull request as ready for review
June 24, 2026 22:07
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement efficient Sparse Multi-Scale Grid algorithm (Benitez-Llambay 2025)
for 3D volume rendering of SPH data. Particles are hierarchically assigned
to grid levels based on kernel smoothing length, then scattered onto
coarse-to-fine grids and upsampled back to target resolution. This bounds
per-particle work regardless of smoothing length, providing significant
speedups for simulations with wide kernel distributions.
Features:
and number of levels (nlevels)
API additions:
Tests:
Documentation:
Code quality: